var AgxNotPlugin =
{

    embedUnity: function(param)
    {                                        
        if(param)
        {
            var params = {
                    backgroundcolor: "00180f",
                    bordercolor: "00180f",
                    textcolor: "00180f",
                    logoimage: 'languages/'+warnerConfig.language+'/images/'+warnerConfig.language+'_logo.png',
                    progressbarimage: "images/load/progress_bar.png",
                    progressframeimage: "images/load/progress_background.png"
                };            
           u3dobject.embed("unityPlayer", "unity/game.unity3d?urlxml="+param , "1000px", "560px", params, null, AgxNotPlugin.unityLoaded);        
        }
        else
        {
          AgxConstruct.showError();
        }
    },
    
    unityLoaded: function(result) 
    {       
        
        if (result.success) 
        {                         
//            $(AgxConstruct.divUnity).remove();                                
//          AgxConstruct.showNotPlugin();            
        }
        else 
        {
            $(AgxConstruct.divUnity).remove();                                
            AgxConstruct.showNotPlugin();            
        }
    },

    downloadPluginUnity: function()
    {
            //OS Detection
            var OS = navigator.userAgent.toLowerCase();
            $.platform = 
            {	
                    mac: /mac/i.test(OS),
                    win: /win/i.test(OS),
                    linux: /linux/i.test(OS)
            };
            $.platform.mac.intel = /intel/i.test(OS);
            $.platform.mac.ppc = /ppc/i.test(OS);


            //Download
            var url;

            if($.platform.win)
            {
                    url = "http://webplayer.unity3d.com/download_webplayer-3.x/UnityWebPlayer.exe";
            }
            else if ($.platform.mac)
            {
                    if($.platform.mac.ppc)
                    {
                            url = "http://webplayer.unity3d.com/download_webplayer-3.x/webplayer-ppc.dmg";
                    }
                    else
                    {
                            url = "http://webplayer.unity3d.com/download_webplayer-3.x/webplayer-i386.dmg";
                    }
            }
            else
            {
                    url = "http://unity3d.com/unity-web-player-3.x";
            }

            window.location.href = url;
    }
}